package com.heima.admin.controller.v1;


import com.heima.admin.service.AdminService;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmSensitive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/v1/sensitive")
public class AdminController {

    @Autowired
    private AdminService adminService;

    //远程调用增加敏感词
    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody WmSensitive wmSensitive) {
        return adminService.saveSensitive(wmSensitive);
    }

    //删除敏感词
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteSensitive(@PathVariable("id") Integer id) {
        return adminService.deleteSensitive(id);
    }

    //修改敏感词
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody WmSensitive wmSensitive) {
        return adminService.updateSensitive(wmSensitive);
    }

    //查询敏感词
    @PostMapping("/list")
    public ResponseResult selectSensitive(@RequestBody SensitiveDto sensitiveDto) {
        return adminService.selectSensitive(sensitiveDto);
    }

}
